const businessService = require('../services/businessService')

const getAllBusinesses = async (req, res) => {
  try {
    const results = await businessService.getAllBusinesses()
    res.json({
      status: 0,
      data: results
    })
  } catch (err) {
    res.json({
      status: 1,
      msg: err.message
    })
  }
}

const createBusiness = async (req, res) => {
  try {
    const result = await businessService.createBusiness(req.body)
    res.json({
      status: 0,
      data: result
    })
  } catch (err) {
    res.json({
      status: 1,
      msg: err.message
    })
  }
}

module.exports = {
  getAllBusinesses,
  createBusiness
}
